package com.ssh.manager.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ssh.dao.IDao;
import com.ssh.entity.TaskBrand;
import com.ssh.entity.TaskImage;
import com.ssh.manager.TaskImageManager;

@Service
public class TaskImageManagerImpl implements TaskImageManager {
	@Resource
	private IDao daoImpl;

	@Override
	public TaskBrand findTaskBrand(long taskId, long brandId) {
		@SuppressWarnings("unchecked")
		List<TaskBrand> taskBrands=(List<TaskBrand>)daoImpl.findListBySql("from TaskBrand where task.id=? and brand.id=? and del=? order by createDate desc", new Object[]{taskId,brandId,0},false, true, false, 0, 1);
        if (taskBrands!=null&&taskBrands.size()>0) {
			return taskBrands.get(0);
		} 
		return null;
	}

	public TaskImage save(TaskImage taskImage){
		
		return daoImpl.saveOrUpdateDomain(taskImage);
	}
}
